From 25b29df94f2ac5aac35d1195608529e47ebad943 Mon Sep 17 00:00:00 2001 From: Guiu Rocafort Date: Tue, 13 Jun 2017 09:21:29 +0200 Subject: [PATCH] bug #783704, Check db NULL to avoid segfault if babl not initiated, --- babl/babl-internal.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/babl/babl-internal.h b/babl/babl-internal.h index 228faa5..42262d6 100644 --- a/babl/babl-internal.h +++ b/babl/babl-internal.h @@ -265,14 +265,22 @@ BABL_CLASS_MINIMAL_IMPLEMENT(klass) \ const Babl * \ babl_##klass (const char *name) \ { \ - Babl *babl; \ + Babl *babl = NULL; \ \ if (babl_hmpf_on_name_lookups) \ { \ babl_log ("%s(\"%s\"): hmpf!", G_STRFUNC, name); \ } \ - babl = babl_db_exist_by_name (db, name); \ \ + if( db != NULL ) \ + { \ + babl = babl_db_exist_by_name (db, name); \ + } \ + else{ \ + babl_fatal("You must call babl_init() first"); \ + } \ + \ + \ if (!babl) \ { \ babl_fatal ("%s(\"%s\"): not found", G_STRFUNC, name); \ -- 2.30.2